/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bayu.services.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Bayu
 */
@Entity
@Table(name = "t_stock")
@NamedQueries({@NamedQuery(name = "TStock.findAll", query = "SELECT t FROM TStock t"), @NamedQuery(name = "TStock.findByIdStock", query = "SELECT t FROM TStock t WHERE t.idStock = :idStock"), @NamedQuery(name = "TStock.findByPlanStock", query = "SELECT t FROM TStock t WHERE t.planStock = :planStock"), @NamedQuery(name = "TStock.findByStockActual", query = "SELECT t FROM TStock t WHERE t.stockActual = :stockActual"), @NamedQuery(name = "TStock.findByNotes", query = "SELECT t FROM TStock t WHERE t.notes = :notes")})
public class TStock implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic()
    @Column(name = "id_stock")
    private String idStock;
    @Basic(optional = false)
    @Column(name = "plan_stock")
    private double planStock;
    @Basic(optional = false)
    @Column(name = "stock_actual")
    private double stockActual;
    @Basic()
    @Column(name = "notes")
    private String notes;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idStock")
    private Collection<TIncomingUsage> tIncomingUsageCollection;

    public TStock() {
    }

    public TStock(String idStock) {
        this.idStock = idStock;
    }

    public TStock(String idStock, double planStock, double stockActual, String notes) {
        this.idStock = idStock;
        this.planStock = planStock;
        this.stockActual = stockActual;
        this.notes = notes;
    }

    public String getIdStock() {
        return idStock;
    }

    public void setIdStock(String idStock) {
        this.idStock = idStock;
    }

    public double getPlanStock() {
        return planStock;
    }

    public void setPlanStock(double planStock) {
        this.planStock = planStock;
    }

    public double getStockActual() {
        return stockActual;
    }

    public void setStockActual(double stockActual) {
        this.stockActual = stockActual;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public Collection<TIncomingUsage> getTIncomingUsageCollection() {
        return tIncomingUsageCollection;
    }

    public void setTIncomingUsageCollection(Collection<TIncomingUsage> tIncomingUsageCollection) {
        this.tIncomingUsageCollection = tIncomingUsageCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStock != null ? idStock.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TStock)) {
            return false;
        }
        TStock other = (TStock) object;
        if ((this.idStock == null && other.idStock != null) || (this.idStock != null && !this.idStock.equals(other.idStock))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bayu.services.entity.TStock[idStock=" + idStock + "]";
    }

}
